<template>
  <div>看打印吧</div>
</template>

<script>
import { useRouter, useRoute } from "vue-router";
import { onBeforeRouteLeave, onBeforeRouteUpdate } from "vue-router";
export default {
  setup() {
    const routerObj = useRouter();
    const routeObj = useRoute();
    console.log(routerObj);
    console.log(routeObj);
    // 与 beforeRouteLeave 相同，无法访问 `this`
    // eslint-disable-next-line no-unused-vars
    onBeforeRouteLeave((to, from) => {});
    // 与 beforeRouteUpdate 相同，无法访问 `this`
    // eslint-disable-next-line no-unused-vars
    onBeforeRouteUpdate(async (to, from) => {});
  },
};
</script>

<style lang="scss" scoped></style>
